package com.songcha.module_main.ui.fragment.calendar

import com.songcha.library_base.mvvm.base.BaseRepository
import com.songcha.library_network.bean.BaseBean
import com.songcha.module_main.api.MainApiManager
import com.songcha.module_main.bean.calendar_task.CalendarTaskRecordBean
import com.songcha.module_memo.bean.wooden_fish.WoodenFishRecordBean
import io.reactivex.Observable
import okhttp3.RequestBody.Companion.toRequestBody
import org.json.JSONObject


class CalendarRepository:BaseRepository() {
    fun updateCalendarTaskRecord(bean:CalendarTaskRecordBean.DataBean): Observable<BaseBean>{
        val json = JSONObject().apply {
            put("id",bean.id)
            //put("one",bean.one)
            put("two",bean.two)
            put("three",bean.three)
            put("four",bean.four)
            put("createDate",bean.createDate)
        }
        return MainApiManager.api.updateCalendarTaskRecord(json.toString().toRequestBody())
    }

    fun getCalendarTaskRecord(date:String): Observable<CalendarTaskRecordBean>{
        return MainApiManager.api.getCalendarTaskRecord(date)
    }

    fun getWoodenFishRecord(): Observable<WoodenFishRecordBean> {
        return MainApiManager.api.getWoodenFishRecord()
    }
}